<template>
    <div>
        <van-nav-bar title="个人资料" left-text="返回" left-arrow @click-left="onClickLeft" />
        <el-form :inline="true" :model="list" class="demo-form-inline">
            <van-cell title="昵称" :value="list.userNick" />
            <van-cell title="性别"  :value="(list.userSex) == 1 ? '男' : '女'" />
            <van-cell title="年龄" :value="list.userAge" />
            <van-cell title="账号" :value="list.userPhone" />
            <van-cell title="余额" :value="list.userPrice" />
            <!-- <van-cell title="密码" is-link :value="list.userPwd" /> -->
            <van-cell title="头像" >
                <van-image round width="30px" height="30px" :src="list.userImg" />
            </van-cell>
              <van-cell is-link title="完善个人资料"  @click="alter"/>
            <van-cell is-link title="退出登录" @click="show1 = true" />          
            <van-action-sheet v-model="show1" :actions="actions" @select="onSelect" />
          
        </el-form>

      
    
    </div>
</template>

<script>
import axios from "axios";
export default {
    data() {
        return {
             
            //  dialogVisible:false,
            show: "",
            list: {},
            show1: false,
          
            actions: [{ name: '退出登录' }],
           
        }
    },
    created() {
        this.getList();
    },
    methods: {
        onClickLeft() {
            this.$router.push({ path: '/friends' })
        },
        getList() {
            axios({
                url: "/api/user/getUserById",
                method: "GET",
                params: {
                    id: JSON.parse(localStorage.getItem('user')).userId,
                }
            }).then((res) => {
                this.list = res.data;
            });
        },
        onSelect(item) {
            this.show1 = false;
           console.log(item.name);
           this.$router.push({ path: '/login' })
        },
        //跳转页面
        alter(){
                     this.$router.push({ path: '/alter' })
        },
       
    },

}
</script>

<style>
.content {
    padding: 16px 16px 160px;
}
</style>